package com.example.LibrarySystem.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.LibrarySystem.pojo.Files;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface FilesMapper extends BaseMapper<Files> {

    @Select("select type from file where uuid = #{uuid}")
    public String getTypeByUUID(String uuid);

    /**
     * 根据传入的表名
     * @param table
     * @return
     */
    @Select("select * from ${table}")
    public List<Map<String,Object>> exportByTable(String table);

    public int insertAllByMap(@Param("map") Map<String,Object> map ,@Param("table") String table);

    @Select("select COLUMN_NAME from information_schema.columns where TABLE_SCHEMA = 'libriry' and TABLE_NAME = #{table}")
    public List<Map<String,Object>> getTableTemplateByColumn(String table);
}
